#pragma once

#include <stdint.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef fourcc
#define fourcc(a, b, c, d)  ((uint32_t)(a) | ((uint32_t)(b) << 8) |((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
#endif

/** 格式转换参数 */
typedef struct pixel_convert_param{
    uint32_t from; //源格式
    uint32_t to;  //目标格式
    uint32_t width; //图像宽度
    uint32_t height; //图像高度
}pixel_convert_param;

/** 计算转换格式大小 */
size_t pixel_output_size(const pixel_convert_param* param);

/** 格式转换，返回结果长度 */
size_t pixel_convert(const pixel_convert_param* param, const void* input, void* output);


size_t pixel_bgr_to_rgb(const void* input, void* output, uint32_t width, uint32_t height);

size_t pixel_bgr_to_bgra(const void* input, void* output, uint32_t width, uint32_t height);

size_t pixel_yuy2_to_bgra(const void* input, void* output, uint32_t width, uint32_t height);

size_t pixel_yuy2_to_bgr(const void* input, void* output, uint32_t width, uint32_t height);

size_t pixel_yuy2_to_rgb(const void* input, void* output, uint32_t width, uint32_t height);

size_t pixel_yuy2_to_gray_rgb(const void* input, void* output, uint32_t width, uint32_t height);

size_t pixel_gray_reverse(const void* input, void* output, uint32_t width, uint32_t height);

size_t pixel_rgb_reverse(const void* input, void* output, uint32_t width, uint32_t height);



#ifdef __cplusplus
}
#endif

